package io.babystar.modules.business.service.impl;

import io.babystar.common.utils.PageUtils;
import io.babystar.common.utils.Query;
import io.babystar.modules.business.dao.BasePayTypeDao;
import io.babystar.modules.business.entity.BasePayTypeEntity;
import io.babystar.modules.business.service.BasePayTypeService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


@Service("basePayTypeService")
public class BasePayTypeServiceImpl extends ServiceImpl<BasePayTypeDao, BasePayTypeEntity> implements BasePayTypeService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String businessId = (String) params.get("businessId");
        String payType = (String) params.get("key");
        IPage<BasePayTypeEntity> page = this.page(
                new Query<BasePayTypeEntity>().getPage(params),
                new QueryWrapper<BasePayTypeEntity>()
                        .eq(StringUtils.isNotBlank(businessId),"business_id",businessId)
                        .eq(StringUtils.isNotBlank(payType),"pay_type",payType)
        );

        return new PageUtils(page);
    }

}